@charset "utf-8";

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* firefox
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.2) transparent;
} */
body {
  font-family: "Noto Sans CJK SC", "Microsoft Yahei", Kaiti, Songti, serif, sans-serif;
  font-size: 14px;
  background: rgba(0,0,0,0); /* transparent */
  max-width: 800px;
  margin: 45px auto;
  padding: 0 5%;
  transition: .1s ease background;
  color: #111;
}

body.dark {
  background: #222;
  color: #ddd;
}

/* #ios-wrapper {
  height: 100%;
  margin: 0 5%;
  position: fixed;
  top: 0;
  left: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}*/

a:link {
  text-decoration: none;
  color: #2077da;
}
a:visited {
  color: #7766da;
}
a:hover {
  text-decoration: underline;
}

u {
  background: rgba(0, 0, 0, 0.2);
  color: rgba(0, 0, 0, 0);
}

u:hover {
  color: inherit;
}

h1 {
  text-align: center;
  font-weight: bold;
  font-size: 2em;
  margin: 3.6em 0 1.8em 0;
}

h2 {
  font-weight: bold;
  font-size: 1.5em;
  margin: 2.4em 0 1.2em 0;
}

h3 {
  font-weight: bold;
  font-size: 1.2em;
  margin: 1.8em 0 0.9em 0;
}

h4 {
  font-weight: bold;
  font-size: 1.1em;
  margin: 1.8em 0 0.9em 0;
}

h2 > i,
h3 > i,
h4 > i {
  float: right;
  font-weight: normal;
  font-size: 1rem;
  color: #666;
}

caption {
  font-weight: bold;
  margin: 0.9em 0 0.9em 0;
}

p, .p {
  margin: 0.8em 0;
}

input, button, textarea {
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  outline-color: #28e;
}

input[type=text] {
  padding: 4px;
}

button, input[type=button] {
  padding: 0 1em;
  background: linear-gradient(#f8f8f8, #ececec);
}

button:hover {
  background: #f8f8f8;
}

hr {
  margin: 10px 0;
}

canvas {
  display: block;
  margin: 5px auto;
}

code, pre {
  font-family: "DejaVu Sans Mono", consolas, monospace;
}

code {
  font-size: 0.9em;
  padding: 3px;
  border-radius: 2px;
}

pre {
  font-size: 0.95em;
  tab-size: 4;
  -moz-tab-size: 4;
  -o-tab-size: 4;

  background: rgba(0,0,0,0.2);
  margin: 0.5em 0;
  padding: 0.5em 1em !important; /* 避免 .solution 覆盖 pre.solution */
  border-radius: 0.5em;
  overflow-x: auto;
}

pre.solution {
  margin: 0 0.5em 0.5em 0;
  border-radius: 0 0.5em 0.5em 0.5em;
}

pre.remark {
  margin: 0.5em;
}

.formula {
  display: table;
  position: relative;
  width: 100%;
  text-align: center;
  line-height: 2em;
  margin: 1em 0;
}

div.scroll-wrapper {
  width: 100%;
  overflow-x: auto;
}

@font-face {
  font-family: "Latin Modern Math";
  src: url("../font/latinmodern-math.woff2") format("woff2");
}

math {
  font-family: "Latin Modern Math", serif;
  font-size: 1.2em;
}
/*mtext,*/
.mord.cjk_fallback {
  font-size: 0.9rem;
}
mi + mtext,
mtext + mi {
  margin-left: 0.3ex;
}
mtd {
  /* correct matrix padding */
  padding: revert;
}

.shadow {
  background: rgba(0,0,0,0.2);
}

.center {
  text-align: center;
}

.remark {
  padding: 0.5em;
  border-radius: 0.5em;
  background: rgba(0,0,0,0.2);
}

.proof, .solution, .answer, .collapse, .toc {
  display: block;
  padding: 0.5em;
  border-radius: 0 0.5em 0.5em 0.5em;
  background: rgba(0,0,0,0.2);
  margin-top: 0;
  /*transition: .5s ease;*/
}

.proof pre, .solution pre, .answer pre, .collapse pre {
  background: transparent;
}

.hidden {
  display: none;
  /*height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;*/
}

.phantom {
  opacity: 0;
}

.error, .katex-error {
  color: crimson;
}

.katex-error {
  max-width: 150px;
  display: inline-block;
  height: 1em;
  line-height: 1em;
  overflow: hidden;
}
.katex-html {
  user-select: none;
}

.ref-preview {
  position: fixed;
  border-radius: 5px;
  border: 1px #ccc solid;
  box-shadow: 3px 3px 5px #aaa;
}
.ref-preview > img {
  height: 90%;
}
.ref-preview > div {
  padding: 10px;
  background: white;
  max-width: 350px;
  max-height: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ref-preview > div.img {
  margin-top: 0;
  margin-bottom: 0;
}
.ref-preview::before {
  content: '';
  display: block;
  position: absolute;
  left: 50%;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  transform: translateX(-50%);
}
.ref-preview-bottom {
  transform: translate(-50%, 40px);
}
.ref-preview-bottom::before {
  top: -15px;
  border-bottom: 15px solid white;
}
.ref-preview-top {
  transform: translate(-50%, -100%);
}
.ref-preview-top::before {
  bottom: -15px;
  border-top: 15px solid white;
}

button.toggle-answer {
  font-size: 1em;
  padding: 0.2em 0.4em;
  border: none;
  font-weight: bold;
  color: inherit;
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 0;
  border-radius: 0.5em;
}

button.toggle-answer:hover {
  cursor: pointer;
}

button.toggle-answer::after {
  content: ' \25b6';
  font-family: 'Dejavu Serif', serif, sans-serif;
}

button.answer-shown {
  border-radius: 0.5em 0.5em 0 0;
}

button.answer-shown::after {
  content: ' \25bc';
}

.box {
  padding: 0.5em;
  border-radius: 0.5em;
  background: rgba(0,0,0,0.2);
}
span.box {
  display: inline-block;
}

/* use this to number your formula */
span.label,span.label-phantom {
  display: table-cell;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

/* ... and this to force align */
span.label-phantom {
  opacity: 0;
}

.pull-left {
  float: left;
}

.pull-right {
  float: right;
}

.fix-left {
  position: absolute;
  left: 0;
}
.break-any {
  line-break: anywhere;
}

span.transparent {
  color: rgba(0, 0, 0, 0);
}

ol, ul {
  margin: 0.8em 0;
}

ol li, ul li {
  margin: 0.3em 1.5em;
}

ol ol li {
  margin: 0.3em 1em;
}

/* ol style (1) (2) (3)... */
ol.enum ol {
  list-style-type: none;
}

ol.enum > ol {
  counter-reset: enum_cnt;
}

ol.enum ol > li {
  counter-increment: enum_cnt;
}

ol.enum ol > li::before {
  content: "(" counter(enum_cnt) ") ";
}

/* ol style i ii iii */
ol.subenum ol {
  counter-reset: subenum_cnt;
}

ol.subenum ol > li {
  counter-increment: subenum_cnt;
}

ol.subenum ol > li:before {
  content: "(" counter(subenum_cnt, lower-roman) ") ";
}

/*
ol.enum ol li {
  display: inline-block;
}
*/

dl dt {
  font-size: 1em;
  font-weight: bold;
}

dl dd {
  margin-bottom: 0.3em;
  margin-left: 2em;
}

.img {
  display: flex;
  flex-direction: column;
  margin: 2em 0;
  text-align: center;
  font-size: 0.9em;
  height: max-content;
  overflow: auto;
}
.img.lg {
  height: 30rem;
}
.img.md {
  height: 20rem;
}
.img.sm {
  height: 13rem;
}
.img.xs {
  height: 10rem;
}
.img img {
  display: block;
  margin: 0 auto;
  height: 90%;
}

/* multi-columns */
.flex {
  display: flex;
  justify-content: space-between;
  overflow: auto;
  flex-wrap: wrap;
}
.flex > div + div {
  margin-left: 10px;
}
.col2 li,.col2 div {
  width: 43%;
  display: inline-block;
}

.col2 .img {
  height: 20em;
}

.col3 li,.col3 div {
  width: 27%;
  display: inline-block;
}

.col4 li,.col4 div {
  width: 18%;
  display: inline-block;
}

.col5 li,.col5 div {
  width: 14%;
  display: inline-block;
}

table {
  margin: 2em auto;
  border-top: 2px solid;
  border-bottom: 2px solid;
}

td, th {
  padding: 0.45em 0.75em 0.45em 0.75em;
}

table.col2 td:nth-child(odd) {
  background: rgba(0,0,0,0.2);
}

table.col2 th:nth-child(odd) {
  background: rgba(0,0,0,0.2);
}

table.col3 td:nth-child(3n+1) {
  background: rgba(0,0,0,0.2);
}

table.col3 td:nth-child(3n+2) {
  background: rgba(0,0,0,0.1);
}

table.col3 th:nth-child(3n+1) {
  background: rgba(0,0,0,0.2);
}

table.col3 th:nth-child(3n+2) {
  background: rgba(0,0,0,0.1);
}

table.col4 td:nth-child(4n+1) {
  background: rgba(0,0,0,0.2);
}

table.col4 td:nth-child(4n+2) {
  background: rgba(0,0,0,0.13);
}

table.col4 td:nth-child(4n+3) {
  background: rgba(0,0,0,0.07);
}

table.col4 th:nth-child(4n+1) {
  background: rgba(0,0,0,0.2);
}

table.col4 th:nth-child(4n+2) {
  background: rgba(0,0,0,0.13);
}

table.col4 th:nth-child(4n+3) {
  background: rgba(0,0,0,0.07);
}

#last-modified {
  text-align: right;
  color: #999;
  float: right;
  clear: both;
}

#notify {
  position: fixed;
  top: 10px;
  left: 40%;
  width: 20%;
  padding: 5px;
  border-radius: 5px;
  text-align: center;
  z-index: 10;
  color: white;
  background: #444;
}

textarea {
  font-size: inherit;
  width: 100%;
  margin: 15px 0;
}

/* enable auto linebreak for span.formula
.MathJax {
  display: inline-block !important;
}*/

/* svg */
svg {
  stroke: black;
  fill: none;
  width: 100%;
}

svg text {
  stroke: none;
  fill: black;
}

svg path.arrow {
  marker-end: url(#arrow-end);
}

svg path.double-arrow {
  marker-start: url(#arrow-start);
  marker-end: url(#arrow-end);
}

svg path.dashed {
  stroke-dasharray: 5, 5;
}

/* tree graph */
div.tree {
  display: table;
}

div.tree span {
  display: table-cell;
  vertical-align: middle;
}

div.tree ul {
  display: table-cell;
  list-style-type: none;
  margin: 0;
  padding: 0.2em;
  border: 5px solid transparent;
  border-left: 20px solid transparent;
  border-image-width: 20px;
  border-image: url(../../img/lbrace.svg) 0 0 0 30 stretch;
}

div.tree li {
  margin: 0;
  padding: 0;
}

#toc,
#toc ul {
  list-style-type: none;
  min-height: 1px;
  clear: both;
}

.playground {
  margin: 5px 0;
}
.playground > p:first-child {
  color: #666;
  font-style: italic;
}
.playground > .ctrl {
  display: flex;
  flex-wrap: wrap;
}
.playground input {
  height: 34px;
}
.playground input[type=text] {
  font-family: monospace;
  flex: auto;
}
.playground textarea {
  margin: 5px 0;
  min-height: 8rem;
  padding: 8px;
}
.playground input + input {
  margin-left: 5px;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.2);
  background-clip: padding-box;
  border-radius: 4px;
  min-height: 28px;
}
::-webkit-scrollbar-track-piece {
  background-color: transparent;
}

::selection {
  background: rgba(0, 0, 0, 0.2);
}
::-moz-selection {
  background: rgba(0, 0, 0, 0.2);
}

/* on printer... */
@media print {
  body {
    margin: 0;
    padding: 0;
    font-size: 10pt;
    font-family: SimSun, Songti, STIXGeneral, times, serif;
    background: white;
  }

  h1, h2, h3, h4, h5, h6, b {
    font-family: "Noto Sans CJK SC", Heiti, "AR PL UMing CN Bold", serif;
    font-weight: bold;
  }

  a {
    color: black;
  }

  /* always show answer */
  .hidden {
    display: revert;
  }

  button.answer-hidden {
    border-radius: 0.5em 0.5em 0 0;
  }

  button.answer-hidden::after {
    content: ' \25bc';
  }

  .pagebreak {
    page-break-after: always;
  }

  /* always display overflow */
  pre {
    overflow-x: revert;
  }

  div.scroll-wrapper {
    overflow-x: revert;
  }
}

@media print {
  .formula > .align {
    display: inline-block;
    text-align: left;
    text-indent: 2em;
    margin: 0 10%;
  }
}

/* desktop */
@media screen and (max-resolution: 149dpi) {
  .formula > .align {
    display: inline-block;
    text-align: left;
    /*text-indent: 2em;*/
    margin: 0 10%;
    padding-left: 20px;
  }
  .formula > .align > br + * {
    margin-left: -20px; /* 等号向左对齐 */
  }
  .formula > .align > br.noindent + * {
    margin-left: 0;
  }
}

/* mobile phone */
@media screen and ((min-resolution: 150dpi) or (-webkit-min-device-pixel-ratio:2)) {
  math {
    font-size: 1em;
  }
  pre {
    font-size: 0.9em;
    padding: 0.5em;
  }
  .img {
    width: 100%;
  }
  .img.lg {
    height: 22rem;
  }
  .img.md {
    height: 15rem;
  }
  .img.sm {
    height: 10rem;
  }
  .img.xs {
    height: 10rem;
  }
  .img > canvas {
    width: 75%;
    height: 75%;
  }
  .flex canvas {
    width: 100%;
    height: 100%;
  }
}

/* 评论区背景色 */
.v[data-class="v"] .vwrap {
  background: #fff;
}
#vcomments {
  margin-top: 40px;
}
